package com.gitee.zhanyao.single.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PageController {

	@GetMapping("/")
	public String index() {
		return "layout/layout";
	}

	@GetMapping("/login-error")
	public String loginError(Model model) {
		model.addAttribute("error", true);
		return "login";
	}

	@RequestMapping("/layout/{page}")
	public String intoPage(@PathVariable String page, Model model){
		model.addAttribute("page", page);
		return "layout/layout";
	}

	@RequestMapping("/page/{page}")
	public String getPageContent(@PathVariable String page){
		return page;
	}

}
